﻿using System;
using System.Collections.Generic;

using DotSpatial.Data;


using DotSpatial.Topology;

using DotSpatial.Symbology;



using System.Data;
using HAUtil;



namespace HAGISV2
{

    [Serializable]
    /// <summary>
    /// 用于表示矢量图层，可以绘制点，线，面 三种形式，付
    /// </summary>
    public class VectorLayer : HybridBaseLayer
    {
        #region 构造函数

        public VectorLayer(string id,LAYERCOVERAGETYPE type)
            : base(id)
        {
            this._layerType = type;
            this._shapeStyleAndIdStorage = new Dictionary<string,ConceptShapesStorageAndDisplayStyle>();
            this._selectedShapes = new List<VectorShape>();
            this._shapes = new List<VectorShape>();
        }


        #endregion

        #region 私有字段

        LAYERCOVERAGETYPE _layerType;
        
        public LAYERCOVERAGETYPE LayerType
        {
            get { return _layerType; }
        }


        #endregion

        #region 受保护的字段

        /// <summary>
        /// shape所属源汇项标记样式,key一律小写
        /// </summary>
        Dictionary<string, ConceptShapesStorageAndDisplayStyle> _shapeStyleAndIdStorage;


        protected List<VectorShape> _selectedShapes;



        protected List<VectorShape> _shapes;
        /// <summary>
        /// 只允许获取不允许操作！
        /// </summary>
        public List<VectorShape> Shapes
        {
            get { return _shapes; }
        }

        #endregion

        #region 公共属性

        public bool IsSetCoorEffective = false;  //右键菜单是否可以设置点的坐标

        # region  所选图形

        //[NonSerialized]
        //private List<IFeature> _selectedFeatures = null;

        ///// <summary>
        ///// 所选的图形，（每个图形只包含一次）
        ///// </summary>
        //public List<IFeature> SelectedFeatures
        //{
           
        //    get { return _selectedFeatures; }
        //    set { this._selectedFeatures = value; }
        //}

        [NonSerialized]
        private List<PointShape> _selectedPoints = null;

        public List<PointShape> SelectedPoints
        {
            get { return _selectedPoints; }
            set { _selectedPoints = value; }
        }



        [NonSerialized]
        private Dictionary<LineShape, List<int>> _selectedVertexs = null;  //顶点

        /// <summary>
        /// 所选的节点
        /// </summary>
        public Dictionary<LineShape, List<int>> SelectedVertexs
        {
            get { return this._selectedVertexs; }
            set { this._selectedVertexs = value; }
        }

        [NonSerialized]
        private List<NodeShape> _selectedNodes = null;   //节点

        /// <summary>
        /// 所选的端点
        /// </summary>
        public List<NodeShape> SelectedNodes
        {
            get { return this._selectedNodes; }
            set { this._selectedNodes = value; }
        }

        [NonSerialized]
        private List<LineShape> _selectedLines = null;

        /// <summary>
        /// 所选的线
        /// </summary>
        public List<LineShape> SelectedLines
        {
            get { return this._selectedLines; }
            set { this._selectedLines = value; }
        }

        [NonSerialized]
        private List<PolyShape> _selectedPolygons = null;

        /// <summary>
        /// 所选的面
        /// </summary>
        public List<PolyShape> SelectedPolygons
        {
            get { return this._selectedPolygons; }
            set { this._selectedPolygons = value; }
        }


        private CONCEPTLAYERRIGHTMENU _type;

        /// <summary>
        /// 哪种图形右键菜单
        /// </summary>
        public CONCEPTLAYERRIGHTMENU Type
        {
            get { return _type; }
        }


        # endregion



        /// <summary>
        /// 概念层shape表现样式及Feature的Id存储
        /// </summary>
        public Dictionary<string, ConceptShapesStorageAndDisplayStyle> ShapeStyleAndIdStorage
        {
            get { return _shapeStyleAndIdStorage; }
        }

        public List<VectorShape> SelectedShapes
        {
            get 
            {
                this._selectedShapes = new List<VectorShape>();

                if (this.SelectedPoints != null)
                {
                    this._selectedShapes.AddRange(this.SelectedPoints.ToArray());
                }
                if (this._selectedNodes != null)
                {
                    this._selectedShapes.AddRange(this.SelectedNodes.ToArray());
                }
                if (this.SelectedLines != null)
                {
                    this._selectedShapes.AddRange(this.SelectedLines.ToArray());
                }
                if (this.SelectedPolygons != null)
                {
                    this._selectedShapes.AddRange(this.SelectedPolygons.ToArray());
                }

                return this._selectedShapes;

            }
            set { _selectedShapes = value; }
        }


        #endregion

        #region 受保护的方法


        protected override void BuildDataset()
        {
            base.BuildDataset();

            DataColumn dc = new DataColumn("id", typeof(string));
            DataColumn dcLn = new DataColumn("id", typeof(string));
            DataColumn dcPy = new DataColumn("id", typeof(string));

            _ptFeatureSet.DataTable.Columns.Add(dc);
            _lnFeatureSet.DataTable.Columns.Add(dcLn);
            _pyFeatureSet.DataTable.Columns.Add(dcPy);



            dc = new DataColumn("desc", typeof(string));
            dcLn = new DataColumn("desc", typeof(string));
            dcPy = new DataColumn("desc", typeof(string));

            _ptFeatureSet.DataTable.Columns.Add(dc);
            _lnFeatureSet.DataTable.Columns.Add(dcLn);
            _pyFeatureSet.DataTable.Columns.Add(dcPy);

            dc = new DataColumn("group", typeof(string));
            dcLn = new DataColumn("group", typeof(string));
            dcPy = new DataColumn("group", typeof(string));

            _ptFeatureSet.DataTable.Columns.Add(dc);
            _lnFeatureSet.DataTable.Columns.Add(dcLn);
            _pyFeatureSet.DataTable.Columns.Add(dcPy);

        }

        protected override void LoadFeatures()
        {
            base.LoadFeatures();



            //这里先测试其他方法
            foreach (VectorShape item in this._shapes)
            {
                this.OnAddShape(item);
            }

        }

        protected override void SaveFeatures()
        {
            //this._ptFeatureSet.SaveAs(this.LayerFileNamePt, true);
            //this._lnFeatureSet.SaveAs(this.LayerFileNameLn, true);
            //this._pyFeatureSet.SaveAs(this.LayerFileNamePy, true);
        }

        protected void OnAddShape(List<VectorShape> shps)
        {
            foreach (VectorShape item in shps)
            {
                if (!(item is NodeShape))
                    this.OnAddShape(item, false);
            }

            this._ptLayer.DataSet.InitializeVertices();
            this._ptLayer.DataSet.UpdateExtent();
            this._ptLayer.Invalidate();
            this._lnLayer.DataSet.InitializeVertices();
            this._lnLayer.DataSet.UpdateExtent();
            this._lnLayer.Invalidate();
            this._pyLayer.DataSet.InitializeVertices();
            this._pyLayer.DataSet.UpdateExtent();
            this._pyLayer.Invalidate();
        }

        private void OnAddShape(VectorShape shp, bool isNeedFresh)
        {
            if (shp is PointShape)
            {
                Feature f = new Feature(shp.Geometry);

                if (f != null)
                {
                    this._ptLayer.DataSet.Features.Add(f);

                    f.DataRow["id"] = shp.Id;
                    f.DataRow["desc"] = shp.Desc;
                    f.DataRow["group"] = shp.GroupName;
                }

                this._ptLayer.SetCategory(f, this._shapeStyleAndIdStorage[shp.GroupName.ToLower()].GetFeatureCategory(MFSHAPETYPE.POINT));

                if (isNeedFresh)
                {
                    this._ptLayer.DataSet.InitializeVertices();
                    this._ptLayer.DataSet.UpdateExtent();
                    this._ptLayer.Invalidate();
                }
            }
            else if (shp is LineShape)
            {
                Feature f = new Feature(shp.Geometry);

                if (f != null)
                {
                    this._lnLayer.DataSet.Features.Add(f);


                    f.DataRow["id"] = shp.Id;
                    f.DataRow["desc"] = shp.Desc;
                    f.DataRow["group"] = shp.GroupName;
                }
                this._lnLayer.SetCategory(f, this._shapeStyleAndIdStorage[shp.GroupName.ToLower()].GetFeatureCategory(MFSHAPETYPE.LINE));

                if (isNeedFresh)
                {
                    this._lnLayer.DataSet.InitializeVertices();
                    this._lnLayer.DataSet.UpdateExtent();
                    this._lnLayer.Invalidate();
                }
            }
            else if (shp is PolyShape)
            {
                Feature f = new Feature(shp.Geometry);

                if (f != null)
                {
                    this._pyLayer.DataSet.Features.Add(f);

                    f.DataRow["id"] = shp.Id;
                    f.DataRow["desc"] = shp.Desc;
                    f.DataRow["group"] = shp.GroupName;
                }

                this._pyLayer.SetCategory(f, this._shapeStyleAndIdStorage[shp.GroupName.ToLower()].GetFeatureCategory(MFSHAPETYPE.POLYGON));

                if (isNeedFresh)
                {
                    this._pyLayer.DataSet.InitializeVertices();
                    this._pyLayer.DataSet.UpdateExtent();
                    this._pyLayer.Invalidate();
                }
            }
        }


        protected void OnAddShape(VectorShape shp)
        {
            this.OnAddShape(shp, true);
        }

        protected void OnClearShape()
        {
            this._ptFeatureSet.Features.Clear();
            this._pyFeatureSet.Features.Clear();
            this._lnFeatureSet.Features.Clear();

            this._ptLayer.Invalidate();
            this._lnLayer.Invalidate();
            this._pyLayer.Invalidate();
        }

        protected void OnRemoveShape(List<VectorShape> shps)
        {
            foreach (VectorShape item in shps)
            {
                if (!(item is NodeShape))
                    this.OnRemoveShape(item, false);
            }

            this._ptLayer.DataSet.InitializeVertices();
            this._ptLayer.DataSet.UpdateExtent();
            this._ptLayer.Invalidate();
            this._lnLayer.DataSet.InitializeVertices();
            this._lnLayer.DataSet.UpdateExtent();
            this._lnLayer.Invalidate();
            this._pyLayer.DataSet.InitializeVertices();
            this._pyLayer.DataSet.UpdateExtent();
            this._pyLayer.Invalidate();
        }

        protected void OnRemoveShape(VectorShape shp)
        {
            this.OnRemoveShape(shp, true);
        }

        protected void OnRemoveShape(VectorShape shp, bool isNeedFresh)
        {
            if (shp is PointShape)
            {
                Feature dFeature;

                foreach (Feature f in this._ptFeatureSet.Features)
                {
                    if ((string)f.DataRow["id"] == shp.Id)
                    {
                        dFeature = f;

                        this._ptFeatureSet.Features.Remove(dFeature);

                        if (isNeedFresh)
                        {
                            this._ptLayer.DataSet.UpdateExtent();
                            this._ptLayer.Invalidate();
                        }

                        return;
                    }
                }
            }


            else if (shp is LineShape)
            {
                Feature dFeature;

                foreach (Feature f in this._lnFeatureSet.Features)
                {
                    if ((string)f.DataRow["id"] == shp.Id)
                    {
                        dFeature = f;

                        this._lnFeatureSet.Features.Remove(dFeature);

                        if (isNeedFresh)
                        {
                            this._lnLayer.DataSet.UpdateExtent();
                            this._lnLayer.Invalidate();
                        }

                        return;
                    }
                }
            }



            else if (shp is PolyShape)
            {

                Feature dFeature;

                foreach (Feature f in this._pyFeatureSet.Features)
                {
                    if (f.DataRow["id"].ToString() == shp.Id)
                    {
                        dFeature = f;

                        this._pyFeatureSet.Features.Remove(dFeature);

                        if (isNeedFresh)
                        {
                            this._pyLayer.DataSet.UpdateExtent();
                            this._pyLayer.Invalidate();
                        }

                        return;
                    }
                }
            }
        }

        /// <summary>
        /// 更改图形代表的实体类型
        /// </summary>
        protected void OnEditFeatureGroupType(VectorShape shp)
        {
            if (shp == null)
                return;

            if (shp is PointShape)
            {
                foreach (Feature feature in _ptLayer.DataSet.Features)
                {
                    if ((string)feature.DataRow["id"] == shp.Id)
                    {
                        feature.DataRow["group"] = shp.GroupName;
                        this._ptLayer.SetCategory(feature, this._shapeStyleAndIdStorage[shp.GroupName.ToLower()].GetFeatureCategory(MFSHAPETYPE.POINT));
                    }
                }
            }


            else if (shp is LineShape)
            {
                foreach (Feature feature in _lnLayer.DataSet.Features)
                {
                    if ((string)feature.DataRow["id"] == shp.Id)
                    {
                        feature.DataRow["group"] = shp.GroupName;

                        //FeatureCategory fc = this._shapeStyleAndIdStorage[shp.GroupName.ToLower()].GetFeatureCategory(MFSHAPETYPE.LINE);
                        //ILineCategory lc = fc as ILineCategory;
                        //if (this._lnLayer.Symbology.Categories.Contains(lc) == false)
                        //{
                        //    this._lnLayer.Symbology.Categories.Add(fc as ILineCategory);
                        //}

                        this._lnLayer.SetCategory(feature, this._shapeStyleAndIdStorage[shp.GroupName.ToLower()].GetFeatureCategory(MFSHAPETYPE.LINE));
                    }
                }
            }


            else if (shp is PolyShape)
            {
                foreach (Feature feature in _pyLayer.DataSet.Features)
                {
                    if ((string)feature.DataRow["id"] == shp.Id)
                    {
                        feature.DataRow["group"] = shp.GroupName;
                        this._pyLayer.SetCategory(feature, this._shapeStyleAndIdStorage[shp.GroupName.ToLower()].GetFeatureCategory(MFSHAPETYPE.POLYGON));
                    }
                }
            }
        }


        protected void OnEditShape(VectorShape shp,bool isNeedUpdate)
        {
            if (shp is PointShape)
            {
                foreach (Feature feature in _ptLayer.DataSet.Features)
                {
                    if ((string)feature.DataRow["id"] == shp.Id)
                    {
                        feature.Coordinates = shp.Geometry.Coordinates;

                        if (isNeedUpdate)
                        {
                            this._ptLayer.DataSet.InitializeVertices();
                            this._ptLayer.DataSet.UpdateExtent();
                            this._ptLayer.Invalidate();
                        }
                        return;
                    }
                }
            }


            else if (shp is LineShape)
            {
                foreach (Feature feature in _lnLayer.DataSet.Features)
                {
                    if ((string)feature.DataRow["id"] == shp.Id)
                    {
                        feature.Coordinates = shp.Geometry.Coordinates;

                        if (isNeedUpdate)
                        {
                            this._lnLayer.DataSet.InitializeVertices();
                            this._lnLayer.DataSet.UpdateExtent();
                            this._lnLayer.Invalidate();
                        }

                        return;
                    }
                }
            }


            else if (shp is PolyShape)
            {
                foreach (Feature feature in _pyLayer.DataSet.Features)
                {
                    if ((string)feature.DataRow["id"] == shp.Id)
                    {
                        (feature.BasicGeometry as Polygon).ExteriorRing.Coordinates = (shp.Geometry as Polygon).ExteriorRing.Coordinates;
                        (feature.BasicGeometry as Polygon).Holes = (shp.Geometry as Polygon).Holes;

                        //(feature.BasicGeometry as Polygon).GeometryChanged();
                        (feature.BasicGeometry as Polygon).UpdateEnvelope();
                        feature.UpdateEnvelope();

                        if (isNeedUpdate)
                        {
                            this._pyLayer.DataSet.InitializeVertices();
                            this._pyLayer.DataSet.UpdateExtent();
                            this._pyLayer.Invalidate();
                        }
                        return;
                    }
                }
            }
        }

        /// <summary>
        /// 编辑多个图形
        /// </summary>
        /// <param name="shps"></param>
        protected void OnEditShape(List<VectorShape> shps)
        {
            foreach (VectorShape item in shps)
            {
                this.OnEditShape(item, false);
            }

            this._ptLayer.DataSet.InitializeVertices();
            this._ptLayer.DataSet.UpdateExtent();
            this._ptLayer.Invalidate();
            this._lnLayer.DataSet.InitializeVertices();
            this._lnLayer.DataSet.UpdateExtent();
            this._lnLayer.Invalidate();
            this._pyLayer.DataSet.InitializeVertices();
            this._pyLayer.DataSet.UpdateExtent();
            this._pyLayer.Invalidate();
        }

        #endregion

        #region 公共方法

        /// <summary>
        /// 设置图层透明度
        /// </summary>
        protected override void OnSetLayerOpacity()
        {
            if (this._isLoaded == false) return;

            foreach (string item in this._shapeStyleAndIdStorage.Keys)
            {
                if (this._shapeStyleAndIdStorage[item].Categories != null && this._shapeStyleAndIdStorage[item].Categories.Count == 3)
                {
                    this._shapeStyleAndIdStorage[item].Opacity = this.Opacity;
                }

            }

            this._ptLayer.Invalidate();
            this._lnLayer.Invalidate();
            this._pyLayer.Invalidate();
        }



        public void EditShapeObjectType(Dictionary<string,string> IdAndGroupNames)
        {
            VectorShape vshp;
            foreach (string id in IdAndGroupNames.Keys)
            {
                vshp = GetShape(id);
                if (vshp == null)
                    continue;
                vshp.GroupName = IdAndGroupNames[id];

                this.OnEditFeatureGroupType(vshp);
            }

            this._ptLayer.Invalidate();
            this._lnLayer.Invalidate();
            this._pyLayer.Invalidate();
        }

        /// <summary>
        /// 编辑多个图形
        /// </summary>
        /// <param name="shps"></param>
        public void EditShape(List<VectorShape> shps)
        {
            VectorShape vshp;
            foreach (VectorShape shp in shps)
            {
                vshp = GetShape(shp.Id);
                if (vshp is PolyShape)
                {
                    (vshp.Geometry as Polygon).ExteriorRing.Coordinates = (shp.Geometry as Polygon).ExteriorRing.Coordinates;
                    (vshp.Geometry as Polygon).Holes = (shp.Geometry as Polygon).Holes;
                    (vshp.Geometry as Polygon).GeometryChanged();
                    (vshp.Geometry as Polygon).UpdateEnvelope();
                }
                else
                    vshp.Geometry.Coordinates = shp.Geometry.Coordinates;
            }

            this.OnEditShape(shps);
        }

        public void EditShape(VectorShape shp)
        {
            VectorShape vshp = GetShape(shp.Id);
            if (vshp is PolyShape)
            {
                (vshp.Geometry as Polygon).ExteriorRing.Coordinates = (shp.Geometry as Polygon).ExteriorRing.Coordinates;
                (vshp.Geometry as Polygon).Holes = (shp.Geometry as Polygon).Holes;
                (vshp.Geometry as Polygon).GeometryChanged();
                (vshp.Geometry as Polygon).UpdateEnvelope();
            }
            else
                vshp.Geometry.Coordinates = shp.Geometry.Coordinates;
            this.OnEditShape(shp, true);
        }

        public void AddShape(List<VectorShape> shps)
        {
            this._shapes.AddRange(shps);

            this.OnAddShape(shps);
        }

        public void AddShape(VectorShape shp)
        {
            this._shapes.Add(shp);

            this.OnAddShape(shp);

        }

        public void ClearShape()
        {
            if (_shapes == null) 
                _shapes = new List<VectorShape>();
            else 
                _shapes.Clear();

            if (_selectedShapes == null) 
                _selectedShapes = new List<VectorShape>();
            else
                _selectedShapes.Clear();

            //if (_selectedFeatures == null)
            //    _selectedFeatures = new List<IFeature>();
            //else
            //    _selectedFeatures.Clear();

            this.OnClearShape();

            //while(_shapes.Count>0)
            //    this.RemoveShape(_shapes[0]);
            
        }


        public void RemoveShape(List<VectorShape> shps)
        {
            foreach (VectorShape item in shps)
            {
                if (!this._shapes.Contains(item))
                {
                    shps.Remove(item);
                }
                else
                    this._shapes.Remove(item);
            }

            this.OnRemoveShape(shps);
        }

        public void RemoveShape(VectorShape shp)
        {
            if (this._shapes.Contains(shp))
            {
                this._shapes.Remove(shp);

                //移除后清空选择
                if (this._selectedShapes.Contains(shp))
                {
                    this._selectedShapes.Remove(shp);

                }

                this.OnRemoveShape(shp);

            }

        }

        /// <summary>
        /// 查找是否有转换来的PolyShape
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public bool ExistSameKeyShp(string key)
        {
            foreach (VectorShape item in this._shapes)
            {
                if (item is PolyShape)
                {
                    if ((item as PolyShape).PolyKey == key) return true;
                }
            }

            return false;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public PolyShape GetSameKeyPolygon(string key)
        {
            foreach (VectorShape item in this._shapes)
            {
                if (item is PolyShape)
                {
                    if ((item as PolyShape).PolyKey == key) return item as PolyShape;
                }
            }

            return null;
        }


        public VectorShape GetShape(string id)
        {

            foreach (VectorShape shp in this._shapes)
            {
                if (shp.Id == id)
                {

                    return shp;
                }

            }


            return null;

        }
        

        #region 切剖分算法部分

        #endregion

        #endregion



        #region 重写的方法

        public override void Render()
        {
            base.Render();
            this.OnSetVisible();
        }

        protected override void OnViewModeChanged()
        {
            this.OnSetVisible();
        }


        public override void StopRender()
        {
            base.StopRender();
        }


        public override bool OpenLayer()
        {
            foreach (ConceptShapesStorageAndDisplayStyle  item in this.ShapeStyleAndIdStorage.Values)
            {
                ///无具体作用 但意义在于初始化item的Categories
                item.GetFeatureCategory(MFSHAPETYPE.LINE);
            }
            return base.OpenLayer();

        }

        public override bool SaveLayer()
        {
            return base.SaveLayer();
        }


        protected override void OnSetVisible()
        {
            if (!this.IsLoaded)
            {
                return;
            }


            if (this._visiable == true && this._viewMode == FMAPVIEW.NORMAL)
            {
                this._ptLayer.IsVisible = true;
                this._lnLayer.IsVisible = true;
                if (this._defaultManager.InteractiveSystem.CurrentLayer != null && this._defaultManager.InteractiveSystem.CurrentLayer == this)
                    this._pyLayer.IsVisible = true;
            }
            else
            {
                this._ptLayer.IsVisible = false;
                this._lnLayer.IsVisible = false;
                this._pyLayer.IsVisible = false;
            }
        }


        #region 选择部分

        public override void Select(IEnvelope tolerant, IEnvelope strict, SelectionMode selectionMode)
        {
            IEnvelope env;

            this._ptLayer.Select(tolerant, strict, selectionMode, out env);
            this._lnLayer.Select(tolerant, strict, selectionMode, out env);
            this._pyLayer.Select(tolerant, strict, selectionMode, out env);


            List<IFeature> selectedFeatures = new List<IFeature>();

            selectedFeatures.AddRange(this._ptLayer.Selection.ToFeatureList());
            selectedFeatures.AddRange(this._lnLayer.Selection.ToFeatureList());
            selectedFeatures.AddRange(this._pyLayer.Selection.ToFeatureList());


            //选择前清空
            this._selectedShapes.Clear();


            foreach (IFeature item in selectedFeatures)
            {
                foreach (VectorShape shp in this._shapes)
                {
                    if (shp.Id == (string)item.DataRow["id"])
                    {
                        this._selectedShapes.Add(shp);

                        continue;
                    }
                }
            }
        }

        public override void ClearSelection()
        {
            base.ClearSelection();

            this._selectedShapes.Clear();
        }

        #endregion


        #endregion


        ///// <summary>
        ///// 外部删除所选图形的点后,进行更新
        ///// </summary>
        ///// <param name="id"></param>
        ///// <param name="isCoordinateEditMoveNotEditDelete"></param>
        //public void UpdateSelectedPoints(string id, bool isCoordinateEditMoveNotEditDelete)
        //{
        //    foreach ( KeyValuePair <IFeature ,List <List <int >>> vertex in this ._selectedVertexs)
        //    {
        //        if (vertex.Key.DataRow["id"].ToString() == id)
        //        {
        //            this._selectedVertexs.Remove(vertex.Key);
        //        }
        //    }

        //}

        ///// <summary>
        ///// 外部重置图形后,更新
        ///// </summary>
        //public void UpdateSelectedFeatures()
        //{
        //    foreach (KeyValuePair<IFeature, List<List<int>>> node in this._selectedNodes)
        //    {
        //        foreach (IFeature feature in this.PtLayer.DataSet.Features)
        //        {
                   
        //        }
        //        foreach (IFeature feature in this._lnLayer.DataSet.Features)
        //        {
        //        }
        //        foreach (IFeature feature in this._pyLayer.DataSet.Features)
        //        {
        //        }
        //    }

        //}


        #region 关于序列化




        #endregion

    }
}
